# define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int k = 0;
    scanf("%d", &k);
    for (int i = 0; i < k; i++)
    {
        for (int j = 0; j < k; j++)
        {
            if ((i == 0 || i == k - 1) || (j == 0 || j == k - 1))
            {
                printf("* ");
            }
            else
                printf("  ");
        }
        printf("\n");
    }
}